package com.yjd.pub.order.service;

import com.yjd.comm.base.dao.IBaseDao;
import com.yjd.comm.base.service.impl.BaseServiceImpl;
import com.yjd.comm.merchant.dto.EverPurchaseProjectDto;
import com.yjd.comm.order.model.OrderProjectModel;
import com.yjd.comm.order.service.IOrderProjectService;
import com.yjd.comm.util.FrameUtil;
import com.yjd.pub.order.dao.IOrderProjectDao;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <b>description</b>：订单项目业务实现<br>
 * <b>time</b>：2017-06-27 08:54:10 <br>
 * <b>author</b>：  yangchangyan@yijiedai.com
 */
@Service("orderProjectService")
public class OrderProjectServiceImpl extends BaseServiceImpl implements IOrderProjectService {

	/**
	 * 插入
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public OrderProjectModel insert(OrderProjectModel model) throws Exception {
		return this.orderProjectDao.insertModel(model, true);
	}

	/**
	 * 更新
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public int update(OrderProjectModel model) throws Exception {
		return this.orderProjectDao.updateModel(model, true);
	}

	/**
	 * 根据id删除
	 * 
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public int delete(long id) throws Exception {
		Map<Object, Object> paramMap = new HashMap<Object, Object>();
		paramMap.put("id", id);
		return this.orderProjectDao.deleteModel(paramMap, true);
	}

	@Override
	public List<Long> queryProjectId(Map<String, Object> param) throws Exception {
		return orderProjectDao.queryProjectId(param);
	}

	@Override
	public List<EverPurchaseProjectDto> everPurchaseProject(Map<String,Object> param) throws Exception {
		return orderProjectDao.everPurchaseProject(param);
	}

	@Resource
	private IOrderProjectDao orderProjectDao;

	@Override
	public IBaseDao getBaseDao() {
		return this.orderProjectDao;
	}

}
